package edu.sctu.wangfuxin.day20150614.testIO;

import java.io.*;

/**
 * Created by user06 on 2015/6/14.
 */
public class TestFileReader {
    int i = 0;
    char[] chars = new char[20];

    public void testFileReader() {
        try {
            FileReader fileReader = new FileReader(new File("D:\\TestIO\\TestFileReader.txt"));
            try {
                FileWriter writer = new FileWriter(new File("D:\\TestIO\\TestFileReader1.txt"));
                while ((i = fileReader.read(chars)) != -1) {
                    System.out.println(chars);
                    writer.write(chars, 0, i);
                }
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }

}
